<%@page import="java.util.List"%>
<%@page import="entities.Category"%>
<%@page import="helpers.PaginatorHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.ArrayList"%>
<%
List<Category> categories = (List<Category>) request.getAttribute("categories");
%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/admin/layouts/header.jsp" />

<link rel="stylesheet" type="text/css" href="/admin/css/jquery.treeview.css" media="screen" />
<script type="text/javascript" src="/admin/js/jquery.treeview.js"></script>
<script type="text/javascript" src="/admin/js/custom/category_dir.js"></script>


					<!-- Content Area -->
                	<div id="da-content-area">
                		<jsp:include page="/admin/elements/message_box.jsp" />
                		
                		<div class="grid_4">
                        	<div class="da-panel collapsible">
                            	<div class="da-panel-header">
                                	<span class="da-panel-title">
                                        <img src="/admin/images/icons/black/16/list.png" alt="" />
                                        Directory Category
                                    </span>
                                    
                                </div>
                                <div class="da-panel-content with-padding">
                                	<ul class="treeview">
                                		<li>
                                		<% 
                                		int level = 1;
                                		for (int i = 0; i < categories.size(); i++) {
                                			Category category = categories.get(i);
                                		%>
	                                		<% if (level == category.getLevel()) { %>
	                                			<% if (i > 1) { %>
		                                		</li>
		                                		<li>
	                                			<% } %>
	                                			<a href="#"><%=category.getName() %></a>
	                                		<% } else if (level > category.getLevel()) {%>
	                                			<% for (int j = 0; j < (level -category.getLevel()); j++) { %>
	                                					</li>
	                                				</ul>
	                                			</li>
	                                			<% } %>
	                                		<li>
	                                			<a href="#"><%=category.getName() %></a>
	                                			
	                                		<% } else { %>
	                                			<ul>
	                                				<li>
	                                				<a href="#"><%=category.getName() %></a>
	                                		<% } %>
	                                		<% level = category.getLevel(); %>
                                		<% } %>
                                		</li>
                                	</ul>
                                </div>
                            </div>
                        </div>
                	</div>

<jsp:include page="/admin/layouts/footer.jsp" />